package com.liruo.treasureattic.common.model.other;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author:liruo
 * @Date:2022-12-03-17:38:38
 * @Desc
 */
@Data
@AllArgsConstructor
public class Pair<K,V>{
    private K key;
    private V value;
    public static <KEY, VALUE> Map<KEY, VALUE> pairsToMap(List<Pair<KEY, VALUE>> pairs){
        HashMap<KEY, VALUE> pairMap = new HashMap<>();
        pairs.forEach(pair->pairMap.put(pair.getKey(),pair.getValue()));
        return pairMap;
    }
}
